/*
 * JavaScript code For uaddress.jsp/skyc_orderpay.jsp
 */
function save() {//保存地址信息
	var aname=$('#aname').val();
	var province=$('#province').val();
	var city=$('#city').val();
	var area=$('#area').val();
	var town=$('#town').val();
	var details=$('#details').val();	
	var uphone=$('#uphone').val();
	if(($("#default").prop("checked"))==false){
		 var udefault="0";
	}else{
		 var udefault="1";
	}
	
	 alert(udefault);
	
	var flag="save";
	$.ajax({
		url : "AddressOrderPayServlet",
		type : "post",
		data : {
			aname : aname,
			province : province,
			city:city,
			area:area,
			town:town,
			details:details,	
			uphone:uphone,
			udefault:udefault,
			flag:flag
			
		},
		//dataType : "json",
		success : function(data) {
			alert(data);
			$('#showdivaa').html(data);				
		},
		error : function(d1, d2) {
			alert(data);
			alert(d1.status + "--" + d2);
		}
	});
}
function adelete(index) {//删除地址信息
	var flag="deleteinfo";
	var aindex=index;
	$.ajax({
		url : "AddressOrderPayServlet",
		type : "post",
		data : {
			
			flag:flag,
			aindex:aindex
		},
		//dataType : "json",
		success : function(data) {		
			$('#showdiv').html(data);				
		},
		error : function(d1, d2) {
			
			alert(d1.status + "--" + d2);
		}	
		});
	
}
function  updateDefault(index) {//更新默认地址信息
	var flag="updateD";
	var aindex=index;
	$.ajax({
		url : "AddressOrderPayServlet",
		type : "post",
		data : {
			
			flag:flag,
			aindex:aindex
		},
		//dataType : "json",
		success : function(data) {		
			$('#showdivaa').html(data);				
		},
		error : function(d1, d2) {
			
			alert(d1.status + "--" + d2);
		}	
		});
}


